using System;
using UnityEngine;

public class IOSNotificationController : ISN_Singleton<IOSNotificationController>
{
	public const string DEVICE_TOKEN_RECEIVED = "device_token_received";

	public const string REMOTE_NOTIFICATION_RECEIVED = "remote_notification_received";

	public const string NOTIFICATION_SCHEDULE_RESULT = "notification_schedule_result";

	private const string PP_ID_KEY = "IOSNotificationControllerKey_ID";

	private static IOSNotificationController _instance;

	private static int _AllowedNotificationsType = -1;

	public Action<IOSNotificationDeviceToken> OnDeviceTokenReceived = delegate
	{
	};

	public Action<ISN_Result> OnNotificationScheduleResult = delegate
	{
	};

	private int GetNextId
	{
		get
		{
			int num = 1;
			if (PlayerPrefs.HasKey("IOSNotificationControllerKey_ID"))
			{
				num = PlayerPrefs.GetInt("IOSNotificationControllerKey_ID");
				num++;
			}
			PlayerPrefs.SetInt("IOSNotificationControllerKey_ID", num);
			return num;
		}
	}

	public static int AllowedNotificationsType
	{
		get
		{
			return _AllowedNotificationsType;
		}
	}

	private void Awake()
	{
		UnityEngine.Object.DontDestroyOnLoad(base.gameObject);
	}

	public void RequestNotificationPermissions()
	{
	}

	public void ShowGmaeKitNotification(string title, string message)
	{
	}

	[Obsolete("ShowNotificationBanner is deprecated, please use ShowGmaeKitNotification instead.")]
	public void ShowNotificationBanner(string title, string message)
	{
		ShowGmaeKitNotification(title, message);
	}

	[Obsolete("CancelNotifications is deprecated, please use CancelAllLocalNotifications instead.")]
	public void CancelNotifications()
	{
		CancelAllLocalNotifications();
	}

	public void CancelAllLocalNotifications()
	{
	}

	public void CancelLocalNotificationById(int notificationId)
	{
	}

	public int ScheduleNotification(int time, string message, bool sound, int badges = 0)
	{
		return GetNextId;
	}

	public void ApplicationIconBadgeNumber(int badges)
	{
	}

	public void OnDeviceTockeReceivedAction(IOSNotificationDeviceToken token)
	{
		dispatch("device_token_received", token);
		OnDeviceTokenReceived(token);
	}

	private void OnNotificationScheduleResultAction(string array)
	{
		string[] array2 = array.Split("|"[0]);
		ISN_Result iSN_Result = null;
		iSN_Result = ((!array2[0].Equals("0")) ? new ISN_Result(true) : new ISN_Result(false));
		_AllowedNotificationsType = Convert.ToInt32(array2[1]);
		OnNotificationScheduleResult(iSN_Result);
		dispatch("notification_schedule_result", iSN_Result);
	}
}
